<?php

#namespace Giocondo;

# box -- A widget which arranges its children horizontal or vertical.
class Box extends Container {
	protected $options = array(
		'children'    => array(),
		'label'       => '',
		'orientation' => 'horizontal'
	);

	#const $default_option = 'label';
	public $default_option = 'label';

	public function display($options=array()) {
		parent::display();

		XHtml::start_tag('fieldset', array('id' => $this->id));
		if ($this->options['label'] != '') {
			XHtml::element('legend', $this->options['label']);
		}
		for ($i = 0; $i < count($this->options['children']); $i++) {
			if ($i != 0 && $this->options['orientation'] === 'vertical') {
				XHtml::element('br');
			}
			$this->options['children'][$i]->display();
		}
		XHtml::end_tag('fieldset');
	}
}

# End of file
# vim: set ts=2 sw=2 noet:
?>
